home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
676-700
/
680
/
atap
/
sourcecode
/
freadline.c
< prev
next >
Wrap
Text File
|
1995-03-18
|
570b
|
38 lines
char *freadline(FILE *sourceFile)
{
static char copyBuffer[128];
static char char1,char2;
static int index,endofstring,dummyChar;
index=0;
endofstring=0;
dummyChar=0;
copyBuffer[0]=0;
while(endofstring==0 && index<127)
{
char1=fgetc(sourceFile);
if (feof(sourceFile))
endofstring=-1;
else if(char1==13)
{
char2=fgetc(sourceFile);
if (char2!=10)
ungetc(char2,sourceFile);
endofstring=-1;
}
else if(char1==10)
endofstring=-1;
else
{
copyBuffer[index]=char1;
index++;
}
}
copyBuffer[index]=0;
return(copyBuffer);
};